{include file="common/header" title="节点管理"}
<style type="text/css">
	.item {
		padding: 5px;
		line-height: 20px;
	}
	.node,.node *{
		color: #ccc;
	}
	.addRule,.editRule{cursor: pointer;}
</style>
<div class="layui-body">
	<!-- 内容主体区域 -->

	<div class="layui-box" style="padding: 20px;">
		<button type="button" id="addMenu" class="layui-btn layui-btn-normal">添加菜单</button>
	</div>
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
		<legend>菜单&节点列表</legend>
	</fieldset>
	<div style="padding: 30px;">
		 
		<table class="layui-table" lay-skin="line">
			<colgroup>
				<col width="">
				<col width="200">
				<col>
			</colgroup>
			<thead>
				<tr>
					<th>名称</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				{:buildRuleTable(0)}
			</tbody>
		</table>
	</div>
</div>
<script>
	layui.use(['layer'], function() {
		var layer = layui.layer;
		var $ = layui.jquery;

		$(document).on('click', '#addMenu', function() {
			layer.open({
				type: 2,
				title: '添加菜单',
				area: ['90%', '99%'],
				content: './add'
			});
		})
		
		$(document).on('click', '.addRule', function() {
			var pid = $(this).data('id')
			var name = $(this).data('name')
			layer.open({
				type: 2,
				title: '添加权限节点',
				area: ['90%', '99%'],
				content: '/admin/rule/addRule?pid='+pid+'&name='+name
			});
		})
		$(document).on('click', '.editRule', function() {
			var id = $(this).data('id')
			var name = $(this).data('name')
			layer.open({
				type: 2,
				title: '编辑',
				area: ['90%', '99%'],
				content: '/admin/rule/editRule?id='+id+'&name='+name
			});
		})
 
	});
</script>
{include file="common/footer"}
